const Controller = require("egg").Controller;
class ChatController extends Controller {
  async index() {
    const { ctx, app } = this;
    console.log("接收到前端传递的消息");
    let message = ctx.args[0];
    console.log(message);
    await ctx.socket.emit("chat", message);
    await ctx.socket.broadcast.emit("chat", message);
  }
}
module.exports = ChatController;